/* GUI CONVERTED from reworp01.p (converter v1.76) Tue Oct  2 12:14:08 2001 */
/* reworp01.p - REPETITIVE   CUM WORKORDER REPORT BASIC wo_mstr DATA          */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.6.1.5 $                                                           */
/* REVISION: 7.3      LAST MODIFIED: 10/31/94   BY: WUG *GN77*                */
/* REVISION: 7.3      LAST MODIFIED: 03/29/95   BY: dzn *F0PN*                */
/* REVISION: 8.5      LAST MODIFIED: 05/12/95   BY: pma *J04T*                */
/* REVISION: 8.6      LAST MODIFIED: 10/14/97   BY: mzv *K0Y7*                */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 11/17/99   BY: *N04H* Vivek Gogte        */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown         */
/* REVISION: 9.1      LAST MODIFIED: 09/11/00   BY: *N0RQ* Mudit Mehta        */
/* $Revision: 1.6.1.5 $   BY: Robin McCarthy        DATE: 10/01/01  ECO: *P025*  */

/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/*V8:ConvertMode=FullGUIReport                                                */


/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE reworp01_p_1 "Start Eff"
/* MaxLen: Comment: */

&SCOPED-DEFINE reworp01_p_2 "Status"
/* MaxLen: Comment: */

&SCOPED-DEFINE reworp01_p_3 "Cum Moved In"
/* MaxLen: Comment: */

&SCOPED-DEFINE reworp01_p_4 "End Effective"
/* MaxLen: Comment: */

&SCOPED-DEFINE reworp01_p_5 "End Eff"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

define variable line like wo_line.
define variable line1 like wo_line label {t001.i}.
define variable lot like wo_lot.
define variable lot1 like wo_lot label {t001.i}.
define variable part like wo_part.
define variable part1 like wo_part label {t001.i}.
define variable site like wo_site.
define variable site1 like wo_site label {t001.i}.
define variable endeff as date label {&reworp01_p_4}.
define variable endeff1 as date label {t001.i}.
define variable moved_in like wr_qty_cummove label {&reworp01_p_3}.

define variable wostatus as character label {&reworp01_p_2}.
define variable active_wolot as character.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
lot                  colon 20
   lot1                 colon 45
   part                 colon 20
   part1                colon 45
   site                 colon 20
   site1                colon 45
   line                 colon 20
   line1                colon 45
   endeff               colon 20
   endeff1              colon 45
 SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

find first gl_ctrl no-lock.

{wbrp01.i}


/*GUI*/ {mfguirpa.i true "printer" 132 " " " " " "  }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:


   if lot1 = hi_char then lot1 = "".
   if part1 = hi_char then part1 = "".
   if site1 = hi_char then site1 = "".
   if line1 = hi_char then line1 = "".

   if c-application-mode <> 'web' then
   
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


   {wbrp06.i &command = update
      &fields = "lot lot1 part part1 site site1
        line line1 endeff endeff1"
      &frm = "a"}

   if (c-application-mode <> 'web') or
      (c-application-mode = 'web' and
      (c-web-request begins 'data'))
   then do:

      bcdparm = "".
      {mfquoter.i lot              }
      {mfquoter.i lot1             }
      {mfquoter.i part             }
      {mfquoter.i part1            }
      {mfquoter.i site             }
      {mfquoter.i site1            }
      {mfquoter.i line             }
      {mfquoter.i line1            }
      {mfquoter.i endeff           }
      {mfquoter.i endeff1          }

      if lot1 = "" then lot1 = hi_char.
      if part1 = "" then part1 = hi_char.
      if site1 = "" then site1 = hi_char.
      if line1 = "" then line1 = hi_char.

   end.

   /* OUTPUT DESTINATION SELECTION */
   
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i "printer" 132 " " " " " " " " }
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:
find first gl_ctrl no-lock.



   {mfphead.i}

   /*NOTE: LOOK AT ALL ORDERS CLOSED OR NOT*/
   moved_in = 0.

   for each wo_mstr no-lock
         where wo_type = "c"
         and wo_lot >= lot and wo_lot <= lot1
         and wo_part >= part and wo_part <= part1
         and wo_site >= site and wo_site <= site1
         and wo_line >= line and wo_line <= line1
         and (wo_due_date >= endeff or endeff = ?)
         and (wo_due_date <= endeff1 or endeff1 = ?)
         and wo_nbr = ""
         use-index wo_type_part,
         each pt_mstr no-lock
         where pt_part = wo_part,
         each pl_mstr no-lock
         where pl_prod_line = pt_prod_line
         by substring(wo_type,1,1) by wo_site by wo_part
         by wo_line by wo_due_date by wo_lot with frame f-a:

      if wo_status = "C" then
         wostatus = getTermLabel("CLOSED",8).
      else do:

         if wo_due_date < today then
            wostatus = getTermLabel("EXPIRED",8).
         else
            wostatus = getTermLabel("ACTIVE",8).
      end.

      /* SET EXTERNAL LABELS */
      setFrameLabels(frame f-a:handle).

      display
         wo_site
         wo_part
         wo_line
         wo_routing
         wo_bom_code
         wo_lot
         wo_rel_date column-label {&reworp01_p_1}
         wo_due_date column-label {&reworp01_p_5}
         wostatus
         wo_batch
      with width 132 no-box STREAM-IO /*GUI*/ .

      
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/


   end.

   
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


end.

{wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" lot lot1 part part1 site site1 line line1 endeff endeff1 "} /*Drive the Report*/
